FROM cimg/go:1.22.8

USER root

# CMD ["tail", "-f", "/dev/null"]

COPY ../mop /mop

WORKDIR /mop

# 安装 ncurses 和 terminfo
RUN apt-get update && apt-get install -y --no-install-recommends \
    ncurses-term \
    libncurses5-dev \
    libncursesw5-dev && \
    rm -rf /var/lib/apt/lists/*  # Clean up to reduce image size

ENV TERM=xterm

# 设置镜像
RUN go env -w GOPROXY=https://goproxy.cn

RUN go build ./cmd/mop

CMD [ "./mop" ]